package com.dymall.auth.controller;

import com.dymall.auth.config.JwtProperties;
import com.dymall.auth.service.AuthService;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth")
@RequiredArgsConstructor
public class AuthController {

    private final AuthService authService;

    /**
     * 生成token
     * @param userId
     * @return token
     */
    @GetMapping("/{userId}")
    public String generateToken(@PathVariable Long userId){
        return authService.createToken(userId);
    }
}
